home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / snip1292.zip / FNDISLOT.C < prev    next >
Text File  |  1992-12-26  |  1KB  |  49 lines

  1. /*
  2. **  Originally published as part of the MicroFirm Function Library
  3. **
  4. **  Copyright 1990, Robert B.Stout
  5. **
  6. **  Subset version released to the public domain, 1992
  7. **
  8. **  Function to locate an unused user interrupt vector.
  9. */
  10.  
  11. #ifdef __ZTC__
  12.  #include <int.h>
  13. #else
  14.  #include <dos.h>
  15.  #ifdef __TURBOC__
  16.   #define GETVECT getvect
  17.   #define FAR far
  18.   #define INTERRUPT interrupt
  19.  #else /* assume MSC */
  20.   #define GETVECT _dos_getvect
  21.   #define FAR _far
  22.   #define INTERRUPT _interrupt
  23.  #endif
  24.  #define FNULL (void (FAR *)())(0L)
  25. #endif
  26.  
  27. unsigned findIslot(void)
  28. {
  29. #ifdef __ZTC__
  30.       unsigned int_no, seg, ofs;
  31.  
  32.       for (int_no = 0x60; int_no < 0x6f; ++int_no)
  33.       {
  34.             int_getvector(int_no, &seg, &ofs);
  35.             if (0U == (seg | ofs))
  36.                   return int_no;
  37.       }
  38. #else /* MSC/BC/TC */
  39.       unsigned int_no;
  40.  
  41.       for (int_no = 0x60; int_no < 0x6f; ++int_no)
  42.       {
  43.             if (FNULL != GETVECT(int_no))
  44.                   return int_no;
  45.       }
  46. #endif
  47.       return 0;
  48. }
  49.